package com.zucc.core.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zucc.core.dao.MiniUserDao;
import com.zucc.core.dao.ReserDao;
import com.zucc.core.po.MiniUser;
import com.zucc.core.po.Reservation;
import com.zucc.core.service.MiniUserService;

@Service("miniUserService")
@Transactional
public class MiniUserServiceImp implements MiniUserService {
	@Autowired
	private MiniUserDao miniUserDao;
	@Autowired
	private ReserDao reserDao;

	public void addMiniUser(MiniUser miniuser) {
		miniUserDao.addMiniUser(miniuser);
		
	}

	public MiniUser selectMiniUserByid(String openId) {
		MiniUser res=miniUserDao.selectMiniUserByid(openId);
		if(res!=null) {
			return res;
		}else {
			return null;
		}
		
	}


	public List<MiniUser> selectMiniUserByName(String nickName) {
		List<MiniUser> res=miniUserDao.searchMiniUser(nickName);
		if(res!=null) {
			return res;
		}else {
			return null;
		}
	}
	
	public int addFriend(MiniUser miniuser) {
		return miniUserDao.addFriend(miniuser);
	}
	
	
	public int checkRes(Reservation reservation) {
		return reserDao.checkRes(reservation);
	}
}
